\(\int \sqrt {-\sec (e+f x)} \sqrt {a-a \sec (e+f x)} \, dx\) [244]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [F(-1)]

Optimal result

Integrand size = 28, antiderivative size = 38 \[ \int \sqrt {-\sec (e+f x)} \sqrt {a-a \sec (e+f x)} \, dx=\frac {2 \sqrt {a} \text {arcsinh}\left (\frac {\sqrt {a} \tan (e+f x)}{\sqrt {a-a \sec (e+f x)}}\right )}{f} \]

[Out]

2*arcsinh(a^(1/2)*tan(f*x+e)/(a-a*sec(f*x+e))^(1/2))*a^(1/2)/f

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.071, Rules used = {3886, 221} \[ \int \sqrt {-\sec (e+f x)} \sqrt {a-a \sec (e+f x)} \, dx=\frac {2 \sqrt {a} \text {arcsinh}\left (\frac {\sqrt {a} \tan (e+f x)}{\sqrt {a-a \sec (e+f x)}}\right )}{f} \]

[In]

Int[Sqrt[-Sec[e + f*x]]*Sqrt[a - a*Sec[e + f*x]],x]

[Out]

(2*Sqrt[a]*ArcSinh[(Sqrt[a]*Tan[e + f*x])/Sqrt[a - a*Sec[e + f*x]]])/f

Rule 221

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Simp[ArcSinh[Rt[b, 2]*(x/Sqrt[a])]/Rt[b, 2], x] /; FreeQ[{a, b},
 x] && GtQ[a, 0] && PosQ[b]

Rule 3886

Int[Sqrt[csc[(e_.) + (f_.)*(x_)]*(d_.)]*Sqrt[csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Dist[-2*(a/(b
*f))*Sqrt[a*(d/b)], Subst[Int[1/Sqrt[1 + x^2/a], x], x, b*(Cot[e + f*x]/Sqrt[a + b*Csc[e + f*x]])], x] /; Free
Q[{a, b, d, e, f}, x] && EqQ[a^2 - b^2, 0] && GtQ[a*(d/b), 0]

Rubi steps \begin{align*} \text {integral}& = \frac {2 \text {Subst}\left (\int \frac {1}{\sqrt {1+\frac {x^2}{a}}} \, dx,x,\frac {a \tan (e+f x)}{\sqrt {a-a \sec (e+f x)}}\right )}{f} \\ & = \frac {2 \sqrt {a} \text {arcsinh}\left (\frac {\sqrt {a} \tan (e+f x)}{\sqrt {a-a \sec (e+f x)}}\right )}{f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.23 (sec) , antiderivative size = 55, normalized size of antiderivative = 1.45 \[ \int \sqrt {-\sec (e+f x)} \sqrt {a-a \sec (e+f x)} \, dx=\frac {2 \arcsin \left (\sqrt {-\sec (e+f x)}\right ) \cot \left (\frac {1}{2} (e+f x)\right ) \sqrt {a-a \sec (e+f x)}}{f \sqrt {1+\sec (e+f x)}} \]

[In]

Integrate[Sqrt[-Sec[e + f*x]]*Sqrt[a - a*Sec[e + f*x]],x]

[Out]

(2*ArcSin[Sqrt[-Sec[e + f*x]]]*Cot[(e + f*x)/2]*Sqrt[a - a*Sec[e + f*x]])/(f*Sqrt[1 + Sec[e + f*x]])

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(129\) vs. \(2(32)=64\).

Time = 1.72 (sec) , antiderivative size = 130, normalized size of antiderivative = 3.42

method result size
default \(-\frac {\sqrt {-a \left (\sec \left (f x +e \right )-1\right )}\, \sqrt {-\sec \left (f x +e \right )}\, \left (\operatorname {arctanh}\left (\frac {-\cos \left (f x +e \right )+\sin \left (f x +e \right )-1}{2 \left (\cos \left (f x +e \right )+1\right ) \sqrt {\frac {1}{\cos \left (f x +e \right )+1}}}\right )-\operatorname {arctanh}\left (\frac {\cos \left (f x +e \right )+\sin \left (f x +e \right )+1}{2 \left (\cos \left (f x +e \right )+1\right ) \sqrt {\frac {1}{\cos \left (f x +e \right )+1}}}\right )\right ) \cot \left (f x +e \right )}{f \sqrt {\frac {1}{\cos \left (f x +e \right )+1}}}\) \(130\)

[In]

int((-sec(f*x+e))^(1/2)*(a-a*sec(f*x+e))^(1/2),x,method=_RETURNVERBOSE)

[Out]

-1/f*(-a*(sec(f*x+e)-1))^(1/2)*(-sec(f*x+e))^(1/2)*(arctanh(1/2*(-cos(f*x+e)+sin(f*x+e)-1)/(cos(f*x+e)+1)/(1/(
cos(f*x+e)+1))^(1/2))-arctanh(1/2*(cos(f*x+e)+sin(f*x+e)+1)/(cos(f*x+e)+1)/(1/(cos(f*x+e)+1))^(1/2)))/(1/(cos(
f*x+e)+1))^(1/2)*cot(f*x+e)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 90 vs. \(2 (32) = 64\).

Time = 0.30 (sec) , antiderivative size = 215, normalized size of antiderivative = 5.66 \[ \int \sqrt {-\sec (e+f x)} \sqrt {a-a \sec (e+f x)} \, dx=\left [\frac {\sqrt {a} \log \left (\frac {4 \, {\left (\cos \left (f x + e\right )^{3} + 3 \, \cos \left (f x + e\right )^{2} + 2 \, \cos \left (f x + e\right )\right )} \sqrt {a} \sqrt {\frac {a \cos \left (f x + e\right ) - a}{\cos \left (f x + e\right )}} \sqrt {-\frac {1}{\cos \left (f x + e\right )}} + {\left (a \cos \left (f x + e\right )^{2} + 8 \, a \cos \left (f x + e\right ) + 8 \, a\right )} \sin \left (f x + e\right )}{\cos \left (f x + e\right )^{2} \sin \left (f x + e\right )}\right )}{2 \, f}, -\frac {\sqrt {-a} \arctan \left (\frac {2 \, {\left (\cos \left (f x + e\right )^{2} + \cos \left (f x + e\right )\right )} \sqrt {-a} \sqrt {\frac {a \cos \left (f x + e\right ) - a}{\cos \left (f x + e\right )}} \sqrt {-\frac {1}{\cos \left (f x + e\right )}}}{{\left (a \cos \left (f x + e\right ) + 2 \, a\right )} \sin \left (f x + e\right )}\right )}{f}\right ] \]

[In]

integrate((-sec(f*x+e))^(1/2)*(a-a*sec(f*x+e))^(1/2),x, algorithm="fricas")

[Out]

[1/2*sqrt(a)*log((4*(cos(f*x + e)^3 + 3*cos(f*x + e)^2 + 2*cos(f*x + e))*sqrt(a)*sqrt((a*cos(f*x + e) - a)/cos
(f*x + e))*sqrt(-1/cos(f*x + e)) + (a*cos(f*x + e)^2 + 8*a*cos(f*x + e) + 8*a)*sin(f*x + e))/(cos(f*x + e)^2*s
in(f*x + e)))/f, -sqrt(-a)*arctan(2*(cos(f*x + e)^2 + cos(f*x + e))*sqrt(-a)*sqrt((a*cos(f*x + e) - a)/cos(f*x
 + e))*sqrt(-1/cos(f*x + e))/((a*cos(f*x + e) + 2*a)*sin(f*x + e)))/f]

Sympy [F]

\[ \int \sqrt {-\sec (e+f x)} \sqrt {a-a \sec (e+f x)} \, dx=\int \sqrt {- \sec {\left (e + f x \right )}} \sqrt {- a \left (\sec {\left (e + f x \right )} - 1\right )}\, dx \]

[In]

integrate((-sec(f*x+e))**(1/2)*(a-a*sec(f*x+e))**(1/2),x)

[Out]

Integral(sqrt(-sec(e + f*x))*sqrt(-a*(sec(e + f*x) - 1)), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 353 vs. \(2 (32) = 64\).

Time = 0.41 (sec) , antiderivative size = 353, normalized size of antiderivative = 9.29 \[ \int \sqrt {-\sec (e+f x)} \sqrt {a-a \sec (e+f x)} \, dx=-\frac {\sqrt {a} {\left (\log \left (2 \, \cos \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right )^{2} + 2 \, \sin \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right )^{2} + 2 \, \sqrt {2} \cos \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right ) + 2 \, \sqrt {2} \sin \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right ) + 2\right ) + \log \left (2 \, \cos \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right )^{2} + 2 \, \sin \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right )^{2} + 2 \, \sqrt {2} \cos \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right ) - 2 \, \sqrt {2} \sin \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right ) + 2\right ) - \log \left (2 \, \cos \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right )^{2} + 2 \, \sin \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right )^{2} - 2 \, \sqrt {2} \cos \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right ) + 2 \, \sqrt {2} \sin \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right ) + 2\right ) - \log \left (2 \, \cos \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right )^{2} + 2 \, \sin \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right )^{2} - 2 \, \sqrt {2} \cos \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right ) - 2 \, \sqrt {2} \sin \left (\frac {1}{2} \, \arctan \left (\sin \left (f x + e\right ), \cos \left (f x + e\right )\right )\right ) + 2\right )\right )}}{2 \, f} \]

[In]

integrate((-sec(f*x+e))^(1/2)*(a-a*sec(f*x+e))^(1/2),x, algorithm="maxima")

[Out]

-1/2*sqrt(a)*(log(2*cos(1/2*arctan2(sin(f*x + e), cos(f*x + e)))^2 + 2*sin(1/2*arctan2(sin(f*x + e), cos(f*x +
 e)))^2 + 2*sqrt(2)*cos(1/2*arctan2(sin(f*x + e), cos(f*x + e))) + 2*sqrt(2)*sin(1/2*arctan2(sin(f*x + e), cos
(f*x + e))) + 2) + log(2*cos(1/2*arctan2(sin(f*x + e), cos(f*x + e)))^2 + 2*sin(1/2*arctan2(sin(f*x + e), cos(
f*x + e)))^2 + 2*sqrt(2)*cos(1/2*arctan2(sin(f*x + e), cos(f*x + e))) - 2*sqrt(2)*sin(1/2*arctan2(sin(f*x + e)
, cos(f*x + e))) + 2) - log(2*cos(1/2*arctan2(sin(f*x + e), cos(f*x + e)))^2 + 2*sin(1/2*arctan2(sin(f*x + e),
 cos(f*x + e)))^2 - 2*sqrt(2)*cos(1/2*arctan2(sin(f*x + e), cos(f*x + e))) + 2*sqrt(2)*sin(1/2*arctan2(sin(f*x
 + e), cos(f*x + e))) + 2) - log(2*cos(1/2*arctan2(sin(f*x + e), cos(f*x + e)))^2 + 2*sin(1/2*arctan2(sin(f*x
+ e), cos(f*x + e)))^2 - 2*sqrt(2)*cos(1/2*arctan2(sin(f*x + e), cos(f*x + e))) - 2*sqrt(2)*sin(1/2*arctan2(si
n(f*x + e), cos(f*x + e))) + 2))/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 98 vs. \(2 (32) = 64\).

Time = 0.66 (sec) , antiderivative size = 98, normalized size of antiderivative = 2.58 \[ \int \sqrt {-\sec (e+f x)} \sqrt {a-a \sec (e+f x)} \, dx=\frac {\sqrt {2} {\left (\frac {\sqrt {2} a^{2} \arctan \left (\frac {\sqrt {2} \sqrt {a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + a}}{2 \, \sqrt {-a}}\right )}{\sqrt {-a}} - \frac {\sqrt {2} a^{2} \arctan \left (\frac {\sqrt {a}}{\sqrt {-a}}\right )}{\sqrt {-a}}\right )} {\left | a \right |} \mathrm {sgn}\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}{a^{2} f} \]

[In]

integrate((-sec(f*x+e))^(1/2)*(a-a*sec(f*x+e))^(1/2),x, algorithm="giac")

[Out]

sqrt(2)*(sqrt(2)*a^2*arctan(1/2*sqrt(2)*sqrt(a*tan(1/2*f*x + 1/2*e)^2 + a)/sqrt(-a))/sqrt(-a) - sqrt(2)*a^2*ar
ctan(sqrt(a)/sqrt(-a))/sqrt(-a))*abs(a)*sgn(tan(1/2*f*x + 1/2*e)^3 + tan(1/2*f*x + 1/2*e))/(a^2*f)

Mupad [F(-1)]

Timed out. \[ \int \sqrt {-\sec (e+f x)} \sqrt {a-a \sec (e+f x)} \, dx=\int \sqrt {a-\frac {a}{\cos \left (e+f\,x\right )}}\,\sqrt {-\frac {1}{\cos \left (e+f\,x\right )}} \,d x \]

[In]

int((a - a/cos(e + f*x))^(1/2)*(-1/cos(e + f*x))^(1/2),x)

[Out]

int((a - a/cos(e + f*x))^(1/2)*(-1/cos(e + f*x))^(1/2), x)